Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
…ut needing to instantiate the full game object
… circular imports issue
…to avoid circular imports issue" This reverts commit 4d46dd5.
|
@tturocy @rahulsavani This is now ready for review - there's a lot happening in this PR, so please take a look at the docs links I've added in the top comment of this PR which should explain how everything now works. I'm going to create some additional feature issues for the catalog and add them to the list in #394 After your review, we can make a bunch of PRs to update the catalog entries for these purposes:
We should decide whether we want to merge this branch into master now and make those PRs there, or alternatively you could branch off |
|
For the catalog interface, I had been thinking we could look more at R's To parallel the When the game is one that's just serialised to a file, that just becomes a simple load of that file. There's not really anything being gained by crafting classes manually - especially because we're going to have game names that don't map to valid Python identifiers (there's good reasons they might start with a digit). This style of game naming ( For parameterised games or games which are generated procedurally, this load call would need to hook into a register of generating functions. (It's my first thought that actually classes aren't the right way to build games and that what we currently have as classes really ought to be functions - and in any event composition is the right way to be thinking about how to build some of these game families and not inheritance. So while we might have classes in places in the generation of games, we shouldn't impose that as an architecture.). Parameterised games could be expressed like So we'd have just a As an additional note here just for memory - it will be useful for us to be able to generate reproducible sets of "random payoff" games. These will be useful for benchmarks, and we hope others would adopt them when they want to do algorithm horse-races. So we might have for example We do not need to do that right now, but the architecture above allows us to do this fairly easily (because with the seed our "random" game generation does become deterministic). |
|
@tturocy thanks for your comment, I'm in agreement with your suggestion to use functions for each game instead of classes and I'm sure I can refactor it that way, especially if it's preferable to retain the game names that don't map to valid Python identifiers (such as those starting with numbers). Part of the motivation of having the informatively named classes was so that the {
"stripped_down_poker": "Stripped-Down Poker: a simple game of one-card poker from Reiley et al (2008).",
...
}... or better still might be a pandas dataframe so a user can easily scroll through a table. What do you think? Another reason for the subclassing system is that the autogenerated set of classes look good on the API reference docs, the catalog's online documentation therefore automatically built. We can still have this if catalog entries are functions instead of classes: but in that case
Doing it that way means the only remaining use for If so, another idea I think you suggested was having an optional attribute called |
|
Closing this PR after discussions last week, see new ideas here: #731 (comment) |
Issues closed by this PR
Description of the changes in this PR
This PR adds infrastructure and documentation for an a first version of the Catalog of games:
contrib/gamestosrc/pygambit/catalog_game_filessrc/pygambit/catalog_games.pyor from file insrc/pygambit/catalog.ymlsrc/pygambit/catalog_update.py(usage described in developer docs)How to review this PR